import {
    getSelectClassPlan,
    getSelectClassPlanInit,
    getClassPank
} from "@/services/index"

import {
    ISelectClassPlan,
    ISelectClassPlanInit,
    IClassPank
} from "@/utils/interface"
import { makeAutoObservable } from "mobx"

class ViewPlans{
    constructor(){
        makeAutoObservable(this)
    }
    SelectClassPlan:ISelectClassPlan[]=[]
    async getSelectClassPlan(classId?:string,id?:string){
        let result = await getSelectClassPlan(classId,id)
        // console.log(classId,id)
        if( result.data ){
            this.SelectClassPlan = result.data
        }
    }
    SelectClassPlanInit:ISelectClassPlanInit = {
        className:"网站2021A班",
        id:"9caafee189ea4165aa2e9d6c5c745321",
        classid:"9",
        planname:"",
        begintime:"2021-05-11 00:00:00",
        states:"0",
        progress:"0",
        countStus:10,
        countUncompleted:0,
        description:"",
        list:[],
        endtime:"2021-05-17 00:00:00",
        countCompleted:"0"
    }
    async getSelectClassPlanInit(classId?:string,id?:string){
        let result = await getSelectClassPlanInit(classId,id)
        // console.log(result.data)
        if( result.data ){
             this.SelectClassPlanInit = result.data
            // return this.SelectClassPlanInit
        }
    }

    ClassPankList:IClassPank[] = []
    async getClassPank(classId?:string,id?:string){
        let result = await getClassPank(classId,id)
        console.log(result.data)
        if( result.data ){
            this.ClassPankList = result.data
        }
    }
}
export default new ViewPlans()